import Data from '@/utils/data.js'

const state = {
	lang: Data.getLanguage() || 'zh',
}

const mutations = {
	SET_LANG: (state, lang) => {
		state.lang = lang
	},
}

const actions = {
	setLang({ commit }, lang) {
		commit('SET_LANG', lang)
		Data.setLanguage(lang)
	},
}

export default {
	namespaced: true,
	state,
	mutations,
	actions,
}
